/**
 *
 * 任何数据类型都可以转换成 any 或 unknown 类型
 */

let symid = Symbol("objid");

console.log("symid", symid);

let obj = { [symid]: 101, username: "wsl" };

let username = obj.username;
console.log("username", username);
let objid = obj[symid]; // symbol 能作为索引类型引用

console.log("objid", objid, obj[symid as any]);
// obj[symid as unknown] // !unknown不能作为索引类型使用

const symunkown = symid as unknown; // 可以转换成unknown
console.log("symunkown", symunkown);

function add(a: number | string, b: number | string) {
  // a + b; //! 加法用于number中
  // 转换成any 解决
  return ((a as any) + b) as any;
}

console.log('add====',add(1,2),add('num',1));

